﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlPhanBoChiTieuBanHang.ascx.cs" Inherits="UserControl_ControlPhanBoChiTieuBanHang" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxPivotGrid.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPivotGrid" tagprefix="dxwpg" %>


<script type="text/javascript">
    function pageLoad() {

        $("#<%= BtnShow.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
    $("#<%= LinkGetHistorySetup.ClientID %>").click(function () {            
             {
                $.blockUI({ css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                    opacity: .5,
                    color: '#fff'
                }
                });
            }
        });


   
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
   
        
        <div class="direct_container_right_titletop">
            Phân bổ chỉ tiêu bán hàng
        </div>
        <hr />
        <!-- Button chuc nang-->
        <div class="direct_container_main">
            <asp:ImageButton ID="imgBtnAdd" CausesValidation="false" ImageUrl="~/Images/add.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnAdd_Click" />
            <asp:ImageButton ID="imgBtnDelete" ToolTip="Xóa nghiệp vụ" onclick="imgBtnDelete_Click" CausesValidation="false" 
                ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />                
            
        </div>
        <!-- End Button chuc nang-->
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" BackColor="#CCFFFF"
            Font-Names="Arial" Width="100%">
             <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="1.Chọn TDV để phân bổ" TabIndex="0">
                <ContentTemplate>
                    <!-- Content main-->
                    <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                              
                                
                               <tr>
                                    <td width="10%" align="right"><p class="direct_label">Chọn quý</p></td>
                                    <td width="90%" align="left"> 
                                        <asp:DropDownList ID="drlistQuy" runat="server" Width="200"> 
                                        <asp:ListItem Text="Quý I" Value="Q1"></asp:ListItem>
                                        <asp:ListItem Text="Quý II" Value="Q2"></asp:ListItem>
                                        <asp:ListItem Text="Quý III" Value="Q3"></asp:ListItem>
                                        <asp:ListItem Text="Quý IV" Value="Q4"></asp:ListItem>   
                                        </asp:DropDownList>
                                        <asp:Label ID="lblYearNow" runat="server" Text=""></asp:Label>  
                                        <asp:Button ID="BtnShow" runat="server" CssClass="direct_bt_search" Text="Xem thông tin" 
                                        onclick="BtnShow_Click" />
                                    </td>
                                    
                                </tr>                                
                               <tr>
                                    <td colspan="2">
                                           <asp:GridView ID="grvTDV" runat="server" AutoGenerateColumns="False" 
                                        onrowcommand="grvTDV_RowCommand" OnPageIndexChanging="grvTDV_PageIndexChanging" 
                                         PageSize="15" AllowPaging="true"
                                         DataKeyNames="salesp_key" EnableModelValidation="True">
                                         <Columns>
                            <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Mã TDV"><HeaderTemplate>
                                                                   Mã TDV
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblsalesp_key" runat="server" Text='<%# Eval("salesp_key")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="100px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tên TDV"><HeaderTemplate>
                                                                   Tên TDV
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblsalesp_name" runat="server" Text='<%# Eval("salesp_name")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Cấp bậc"><HeaderTemplate>
                                                                   Cấp bậc
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblCapBac" runat="server" Text='<%# Eval("CapBac")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tuyến trên"><HeaderTemplate>
                                                                   Tuyến trên
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblRecommender" runat="server" Text='<%# Eval("Recommender")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="250px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="250px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Cấp bậc tuyến trên"><HeaderTemplate>
                                                                  Cấp bậc tuyến trên
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblCapBacRecommender" runat="server" Text='<%# Eval("CapBacTuyenTren")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>

<asp:TemplateField HeaderText="Đã phân tuyến"><HeaderTemplate>
                                                                  Đã phân bổ
                                                                
</HeaderTemplate>
<ItemTemplate>
            <asp:CheckBox ID="chIsSet" Enabled="false" runat="server" Checked='<%# Eval("isSet")%>' />                                                  
                                                              
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="100px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="100px" />
</asp:TemplateField>
<asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="20px" ImageUrl="~/Images/check.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
</Columns>
</asp:GridView>
                                    </td>
                               </tr>
                            </table>
                        </div>
                    </div>
                    <!-- EndContent main-->
                </ContentTemplate>
            </cc1:TabPanel> 
             <cc1:TabPanel ID="TabPanel4" runat="server" HeaderText="2.Phân bổ chỉ tiêu cho sản phẩm" TabIndex="1">
                <ContentTemplate>
                     <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                                     <tr>
                                         <td colspan="2">
                                                 Phân bổ chỉ tiêu cho trình dược viên 
                                             <asp:Label ID="lblInforTDV" runat="server" Text=""></asp:Label>
                                        </td>
                                     </tr> 
                                      <tr>
                                         <td colspan="2">
                                                <asp:LinkButton onclick="LinkGetHistorySetup_Click" ID="LinkGetHistorySetup" runat="server">Click vào đây nếu bạn có muốn phân bổ chỉ tiêu dựa vào dữ liệu trước đây</asp:LinkButton>
                                        </td>
                                     </tr> 
                                      <tr>
                                         <td colspan="2">
                                                 <asp:Button ID="btnSave" runat="server" CssClass="direct_bt_search" Text="Lưu thông tin" 
                                        onclick="btnSave_Click" />
                                               
                                        </td>
                                     </tr> 
                                <tr>
                       <td colspan="2">
                             <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                     
                                         EnableModelValidation="True">
                                         <Columns>
                                        <asp:TemplateField HeaderText="Stt">
                                <HeaderTemplate>
                                                                    STT
                                                                
                                         
                                </HeaderTemplate>
                            <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Mã sản phẩm(SKU)"><HeaderTemplate>
                                                                    Mã sản phẩm(SKU)
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblItemkey" runat="server" Text='<%# Eval("Itemkey")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Tên sản phẩm"><HeaderTemplate>
                                                                    Tên sản phẩm
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Focus"><HeaderTemplate>
                                                                    Focus
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
    <asp:CheckBox ID="chIsFocus" Checked='<%# Eval("isFocus")%>' runat="server" />                                                    
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="500px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="500px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Group"><HeaderTemplate>
                                                                    Group
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblGroup" runat="server" Text='<%# Eval("Group")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Channel"><HeaderTemplate>
                                                                    Channel
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblChannel" runat="server" Text='<%# Eval("Channel")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Nguyên giá"><HeaderTemplate>
                                                                    Nguyên giá
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblCost" runat="server" Text='<%# Eval("price")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
 <asp:TemplateField HeaderText="Số lượng"><HeaderTemplate>
                                                                    Số lượng
                                                                
</HeaderTemplate>
<ItemTemplate>
    <asp:TextBox ID="txtSL" Text='<%# Eval("QTY")%>' runat="server"></asp:TextBox>                                                      
                                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
                                        <asp:TemplateField HeaderText="Nhà phân phối"><HeaderTemplate>
                                                                    Nhà phân phối
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblNPP" runat="server" Text='<%# Eval("sitename")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>

                                    </Columns>
                                </asp:GridView>
                       </td>
                       </tr>  
                            </table>
                        </div>
                    </div>
                </ContentTemplate>
            </cc1:TabPanel>           
             <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="3.Chi tiết phân bổ chỉ tiêu" TabIndex="2">
                <ContentTemplate>
                    <!-- Content main-->
                        <div class="direct_container_main">
                            <div class="direct_container_form_right">
                               <table border="0" width="100%">
                                   
                                   <tr>
                                   <td colspan="2">                       
                                            <dxwpg:ASPxPivotGrid ID="ASPxPivotGrid1"  runat="server">
                                             <Fields>
                                                   
                                                    <dxwpg:PivotGridField ID="PivotGridField2" Area="RowArea"  AreaIndex="0" 
                                                     Caption="Quý" FieldName="Quy">
                                                    </dxwpg:PivotGridField>
                                                     <dxwpg:PivotGridField ID="PivotGridField3" Area="RowArea"  AreaIndex="2" 
                                                     Caption="Họ tên" FieldName="TDV">
                                                    </dxwpg:PivotGridField>
                                                     <dxwpg:PivotGridField ID="PivotGridField4" Area="RowArea"  AreaIndex="4" 
                                                     Caption="Sản phẩm" FieldName="itemkey">
                                                    </dxwpg:PivotGridField>             
                                                     <dxwpg:PivotGridField ID="PivotGridField9" Area="RowArea"  AreaIndex="5" 
                                                     Caption="Focus" FieldName="Focus">
                                                    </dxwpg:PivotGridField>               
                                                     <dxwpg:PivotGridField ID="PivotGridField5" Area="RowArea"  AreaIndex="6" 
                                                     Caption="Số lượng" FieldName="Qty">
                                                    </dxwpg:PivotGridField>
                                                    
                                                     <dxwpg:PivotGridField ID="PivotGridField6" Area="RowArea"  AreaIndex="7" 
                                                     Caption="Nguyên giá" FieldName="NGUYENGIA">
                                                    </dxwpg:PivotGridField>
                                                     <dxwpg:PivotGridField ID="PivotGridField1" Area="RowArea"  AreaIndex="8" 
                                                     Caption="Channel" FieldName="Channel">
                                                    </dxwpg:PivotGridField>
                                                     <dxwpg:PivotGridField ID="PivotGridField7" Area="RowArea"  AreaIndex="9" 
                                                     Caption="Group" FieldName="Group">
                                                    </dxwpg:PivotGridField>

                                                     <dxwpg:PivotGridField ID="PivotGridField8" Area="RowArea"  AreaIndex="10" 
                                                     Caption="NPP của sản phẩm" FieldName="Sitename">
                                                    </dxwpg:PivotGridField>
                                                </Fields>
                                                <OptionsPager Visible="False">
                                                </OptionsPager>
                                                <OptionsView  ShowColumnGrandTotals="True" ShowRowGrandTotals="True" />
                                                </dxwpg:ASPxPivotGrid>
                                                                                  
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <!-- EndContent main-->
                </ContentTemplate>
            </cc1:TabPanel>            
          
        </cc1:TabContainer>
        <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="Thông báo" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>
